<%
//标签的几个参数说明：
//title,网页的标题，默认是“岑峦网”
//menu，可不填，如果有值就代表相应的菜单是已选中样式
//validate，可不填，如果有值，生成会包含验证插件相关的脚本
//markdown，非必填，如果有值表示要引入markdown编辑器的脚本的样式
//uploader，有值表示要引入上传组件脚本
//stats，如果有值表示要引用统计代码
//datepicker，表示要引入日期选择插件的脚本和样式
//mm,mobile menu手机菜单，表示在小尺寸设备上才显示的菜单，一个包含title和url这两个属性的对象
//mms，多个手机菜单列表，mm对象数组
%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=11">
	<title>${title!"岑峦网"}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
	<!--jquery-->
	<script src="/static/ext/jquery/jquery-2.1.1.min.js"></script>
	<!--bootstrap-->
	<link href="/static/ext/bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<script src="/static/ext/bootstrap/js/bootstrap.min.js"></script>
	<!--jquery.form-->
	<script src="/static/ext/jquery/plugin/jquery.form.js"></script>
	<!-- public -->
	<link rel="stylesheet" href="/static/css/public.css" />
	<script src="/static/js/public.js"></script>
<%if(!isEmpty(validate)){%>
	<script src="/static/ext/jquery/plugin/jquery.validate.min.js"></script>
	<script src="/static/ext/jquery/plugin/validate_message_zh.js"></script>
	<script src="/static/js/custom-validate.js"></script>
<%}%>
<%if(!isEmpty(markdown)){%>
	<link rel="stylesheet" type="text/css" href="/static/ext/markdown/bootstrap-markdown.min.css" />
	<script src="/static/ext/markdown/markdown.js"></script>
	<script src="/static/ext/markdown/to-markdown.js"></script>
	<script src="/static/ext/markdown/bootstrap-markdown.js"></script>
	<script src="/static/ext/markdown/bootstrap-markdown.zh.js"></script>
<%}%>
<%if(!isEmpty(uploader)){%>
	<script src="/static/ext/WebUploader/webuploader.min.js"></script>
<%}%>
<%if(!isEmpty(datepicker)){%>
	<link rel="stylesheet" type="text/css" href="/static/ext/bootstrap-datepicker/datepicker.min.css">
	<script src="/static/ext/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
	<script src="/static/ext/bootstrap-datepicker/bootstrap-datetimepicker.zh-CN.js"></script>
<%}%>
</head>
<body>
	<nav class="navbar navbar-default" role="navigation">
		<div class="container">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed"
					data-toggle="collapse" data-target="#navbar-collapse">
					<span class="sr-only">切换导航栏显示</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="/">
					<img src="/static/img/logo.jpg" alt="岑峦网"/>
				</a>
			</div>
			 <div class="collapse navbar-collapse" id="navbar-collapse">
			 	<ul class="nav navbar-nav">
			 		<li <%if("gallery"==menu!){print("class='active'");} %>><a href="/gallery">相册</a></li>
			 		<li <%if("vote"==menu!){print("class='active'");} %>><a href="/vote">投票</a></li>
			 		<li <%if("tweet"==menu!){print("class='active'");} %>"><a href="/tweet">蹦跶</a></li>
			 		<li <%if("blog"==menu!){print("class='active'");} %>"><a href="/blog">笔记</a></li>
			 		<li <%if("activity"==menu!){print("class='active'");} %>"><a href="/activity">活动</a></li>
			 		<li class="visible-xs <%if("app"==menu!){print("active");} %>"><a href="/app">应用</a></li>
			 	</ul>
			 	<ul class="nav navbar-nav navbar-right">
			 		<%if(!isEmpty(session.user)){%>
			 			<li <%if("user"==menu!){print("active");}%>">
			 				<a href="/me/log">
			 					<span class="glyphicon glyphicon-user"></span>&nbsp;${session.user.nickname}
			 				</a>
			 			</li>
			 			<li><a href="javascript:if(confirm('确定要退出吗？')){location='/login/logout'};">退出</a></li>
					<%}else{%>
				 		<li><a href="/login">登录</a></li>
			 		<%}%>
			 		<%if(!isEmpty(mm)||!isEmpty(mms)){%>
			 			<li class="visible-xs" style="border-bottom:1px solid #e5e5e5;"></li>
			 		<%}%>
			 		<%if(!isEmpty(mm)){%>
			 			<li class="visible-xs"><a href="${mm.url}">${mm.title}</a></li>
			 		<%}%>
			 		<%if(!isEmpty(mms)){%>
			 			<%for(m in mms){%>
			 			<li class="visible-xs"><a href="${m.url}">${m.title}</a></li>
			 			<%}%>
			 		<%}%>
			 	</ul>
			 </div>
		</div>
	</nav>
	<div class="container">
	${tagBody}
	</div>

	<footer>
		<a class="text-muted" href="/about">关于本站</a>
		&nbsp;|&nbsp;
		<a class="text-muted" href="http://www.miitbeian.gov.cn/">沪ICP备14026801号</a>
		<%if(!isEmpty(stats)&&!devMode){%>
			&nbsp;|&nbsp;
			<script>
			var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
			document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F185751cba1f436fc1f6d171018f4e530' type='text/javascript'%3E%3C/script%3E"));
			</script>
		<%}%>
	</footer>
</body>
</html>